export default {
    namespaced: true,
    state: {
        //是否显示提示框
        isShowToast: false,
        //提示内容
        toastMsg: "11",
        //success（绿色）  danger(红色)  warning(黄色)
        toastType: "danger"
    },
    mutations: {
        //修改是否显示模态框的数据
        changIsShowToast(state, payload) {
            state.isShowToast = payload.isShow;
            if (payload.isShow) {
                state.toastMsg = payload.title;
                state.toastType = payload.type;
            }
        }
    },
    actions:{
        asyncIsShowToast({commit},payload){
            //第一步,显示提示框
            commit("changIsShowToast",payload)
            //第二步异步操作隐藏提示框
            setTimeout(()=>{
                commit("changIsShowToast",{
                    isShow:false
                })
            },1000)
        }
    }
}